<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:61:"E:\yangjian\public/../application/index\view\index\index.html";i:1529823297;s:45:"../application/index/view/default/header.html";i:1529654189;}*/ ?>
<!DOCTYPE HTML>
<html>

<head>
	<title>团团呗的个人信息管理网站</title>
	<meta charset="utf-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1" />
	<!--[if lte IE 8]><script src="/static/js/ie/html5shiv.js"></script><![endif]-->
	<link rel="stylesheet" href="/static/css/main.css" />
	<script src="http://apps.bdimg.com/libs/jquery/1.11.3/jquery.min.js"></script>
	<!--[if lte IE 9]><link rel="stylesheet" href="/static/css/ie9.css" /><![endif]-->
	<!--[if lte IE 8]><link rel="stylesheet" href="/static/css/ie8.css" /><![endif]-->
	<link rel="stylesheet" href="/static/css/login.css">
	<script src="/static/js/jquery.min.js"></script>
	<script src="/static/js/jquery.min.js"></script>
	<script src="/static/js/skel.min.js"></script>
	<script src="/static/js/util.js"></script>
	<!--[if lte IE 8]><script src="/static/js/ie/respond.min.js"></script><![endif]-->
	<script src="/static/js/main.js"></script>
	<script>
		$(function () { 

			$('.loginBtn').on('click',function(){
				$('.login').removeClass('none');
				$('.register').addClass('none');
			})
			$('.registerBtn').on('click',function(){
				$('.login').addClass('none');
				$('.register').removeClass('none')
			})
			$('.x').on('click',function(){
				$('.login').addClass('none');
				$('.register').addClass('none');
			})

			
		 });
	</script>
	<script>
		$(document).ready(function() {
			$('#login-submit').on('click',function(){
				$.ajax({
					type:'POST',
					url:'/index/user/login',
					dataType:'json',
					data:{'username':$('#login .username').val(),'password':$('#login .password').val()},
					success:function(data){
						alert(data.msg);
						if(!data.type) {
							window.location.reload();
						}
					}
				});
			});
	
			$('#register-submit').on('click',function(){
				$.ajax({
					type:'POST',
					url:'/index/user/register',
					dataType:'json',
					data:{'username':$('#register .username').val(),'password':$('#register .password').val(),'repassword':$('#register .repassword').val()},
					success:function(data){
						alert(data.msg);
						if(!data.type){
							window.location.reload();
						}
					}
				});
			});
		})
	
	</script>
</head>

<body id="top" >

	<!-- Wrapper -->
	<div id="wrapper">

		<!-- Header -->
		<header id="header">
			<h1>
				<a href="/">个人信息管理网站</a>
			</h1>
			<nav class="links">
				<ul>
					<li>
						<a href="/">博客</a>
					</li>
					<li>
						<a href="/index/contacts">个人通讯录</a>
					</li>
					<li>
						<a href="/admin/index/login">网站后台管理</a>
					</li>
					<?php if($userData){ ?>
					<li>
						<a href="#">欢迎<?php echo $userData['username']; ?>登陆！<span>用户ID为<?php echo $userData['uid']; ?></span></a>
					</li>
					<li>
						<a href="/index/user/loginout" id="loginout" >注销</a>
					</li>
					<?php }else{ ?>
					<li>
						<a href="#" class="loginBtn" >登陆</a>
					</li>
					<li>
						<a href="#" class="registerBtn" >注册</a>
					</li>
					<?php } ?>
				</ul>
			</nav>
			<nav class="main">
				<ul>
					<!-- <li class="search">
						<a class="fa-search" href="#search">Search</a>
						<form id="search" method="get" action="#">
							<input type="text" name="query" placeholder="搜索" />
						</form>
					</li> -->
					<li class="menu">
						<a class="fa-bars" href="#menu">Menu</a>
					</li>
				</ul>
			</nav>
		</header>

		<!-- Menu -->
		<section id="menu">

			<!-- Search -->
			<!-- <section>
				<form class="search" method="get" action="#">
					<input type="text" name="query" placeholder="搜索" />
				</form>
			</section> -->

			<!-- Links -->
			<section>
				<ul class="links">
					<li>
						<a href="/">
							<h3>个人博客</h3>
							<p>勇敢的人不是不害怕，而是怕也要向前走。</p>
						</a>
					</li>
					<li>
						<a href="/index/contacts">
							<h3>个人通讯录</h3>
							<p>请登录后再使用，建议使用1366X768或以上的分辨率浏览</p>
						</a>
					</li>
					<li>
						<a href="/admin/index/login">
							<h3>网站后台管理</h3>
							<p>请登录后再使用，建议使用1366X768或以上的分辨率浏览</p>
						</a>
					</li>
				</ul>
			</section>

			<!-- Actions -->
			<section>
				<ul class="actions vertical">
					<?php if($userData){ ?>
					<li>
						<a href="#">欢迎<?php echo $userData['username']; ?>登陆！</a>
					</li>
					<li>
						<a href="/index/user/loginout" id="loginout" >注销</a>
					</li>
					<?php }else{ ?>
					<li>
						<a href="#" class="loginBtn" >登陆</a>
					</li>
					<li>
						<a href="#" class="registerBtn" >注册</a>
					</li>
					<?php } ?>
				</ul>
			</section>

		</section>

		<div class="login none " id="login" >
			<h3>用户登录</h3>
			<form>
				<div>
					<span>用户名：</span>
					<input class="username" type="text" placeholder="请输入用户名" >
				</div>
				<div>
					<span>密码：</span>
					<input class="password" type="password" placeholder="请输入密码" >
				</div>
				<div>
					<button type="submit" id="login-submit"  >登录</button>
				</div>
			</form>
			<i class="x"></i>
		</div>
		<div class="register none" id="register" >
				<h3>用户注册</h3>
				<form>
					<div>
						<span>用户名：</span>
						<input class="username" type="text" placeholder="请输入用户名" >
					</div>
					<div>
						<span>密码：</span>
						<input class="password" type="password" placeholder="请输入密码" >
					</div>
					<div>
						<span>确认密码：</span>
						<input class="repassword" type="password" placeholder="再次输入密码" >
					</div>
					<div>
						<button type="submit" id="register-submit" >注册</button>
					</div>
				</form>
				<i class="x"></i>
			</div>


<style>
	#pagination li{
		padding: 0;
	}
	#pagination li a{
		display: inline-block;
		padding: 0.3em 1.3em;
		border: solid 1px rgba(160, 160, 160, 0.3);
		background: #fff;
		margin-right: 10px;
		font-size: 18px; 
	}
	#pagination .active a{
		color: #2ebaae;
		border-color:#2ebaae !important; 
	}

</style>
		<!-- Main -->
		<div id="main">

			<!-- Post -->
			
					
			<div id="article">

			</div>


			<ul class="actions pagination" id="pagination"></ul>

		</div>


		<!-- Sidebar -->
		<section id="sidebar">

			<!-- Intro -->
			<section id="intro">
				<a href="#" class="logo">
					<img src="/static/images/logo.jpg" alt="" />
				</a>
				<header>
					<h2>个人信息管理网站</h2>
					<p>是一个记录自己生活中的点点滴滴，分享一些个人的琐碎往事。青春是一本仓促的书，我们流着泪一读再读。</p>
				</header>
			</section>

			<!-- Mini Posts -->
			<section>
				<div class="mini-posts">

					<!-- Mini Post -->
					<?php foreach($RecommendNewsList as $Recommend){?>
					<article class="mini-post">
						<header>
							<h3>
								<a href="#"><?php echo $Recommend['title']; ?></a>
							</h3>
							<time class="published" datetime="2018-10-20"><?php echo date('Y-m-d',strtotime($Recommend['ntime']));?></time>
							<a href="#" class="author">
								<img src="/static/images/avatar.jpg" alt="" />
							</a>
						</header>
						<a href="#" class="image">
							<img src="/uploads/<?php echo $Recommend['imgurl']; ?>" alt="" />
						</a>
					</article>
					<?php }?>
					



				</div>
			</section>

			<!-- Posts List -->
			<!-- <section>
				<ul class="posts">
					<li>
						<article>
							<header>
								<h3>
									<a href="#">更新日志，个人通讯录新增邮箱添加功能</a>
								</h3>
								<time class="published" datetime="2018-10-20">5月  20, 2018</time>
							</header>
							<a href="#" class="image">
								<img src="/static/images/pic08.jpg" alt="" />
							</a>
						</article>
					</li><li><article>
							<header>
								<h3>
									<a href="#">更新日志，个人通讯录现在可以添加地区信息了</a>
								</h3>
								<time class="published" datetime="2018-10-15">5月  15, 2018</time>
							</header>
							<a href="#" class="image">
								<img src="/static/images/pic09.jpg" alt="" />
							</a>
						</article></li><li><article><header><h3><a href="#">更新日志，现在个人通讯录正式版以向外开放了</a></h3><time class="published" datetime="2018-10-10">5月  10, 2018</time></header>
							<a href="#" class="image">
								<img src="/static/images/pic10.jpg" alt="" />
							</a>
						</article>
					</li><li><article><header><h3>
									<a href="#">更新日志，个人通讯录测试版可以抢先体验了</a>
								</h3>
								<time class="published" datetime="2018-10-08">5月  8, 2018</time>
							</header>
							<a href="#" class="image">
								<img src="/static/images/pic11.jpg" alt="" />
							</a>
						</article>
					</li></ul>
			</section> -->

			<!-- About -->
			<section class="blurb">
				<h2>关于我</h2>
				<p>杨建的个人信息管理网站
					<br/>是一个记录自己生活中的点点滴滴，分享一些个人的琐碎往事。
					<br/>青春是一本仓促的书，我们流着泪一读再读。</p>
				<!-- <ul class="actions">
					<li>
						<a href="#" class="button">了解更多</a>
					</li>
				</ul> -->
			</section>

			<!-- Footer -->
			<!-- <section id="footer">
				<ul class="icons">
					<li>
						<a href="#" class="fa-twitter">
							<span class="label">Twitter</span>
						</a>
					</li>
					<li>
						<a href="#" class="fa-facebook">
							<span class="label">Facebook</span>
						</a></li><li>
						<a href="#" class="fa-instagram">
							<span class="label">Instagram</span>
						</a>
					</li>
					<li>
						<a href="#" class="fa-rss">
							<span class="label">RSS</span>
						</a>
					</li>
					<li>
						<a href="#" class="fa-envelope">
							<span class="label">Email</span>
						</a></li></ul>
				<p class="copyright">团团呗的个人信息管理网站</p>
			</section> -->

		</section>

	</div>


	<!-- Scripts -->
	
	<script>
	
	$(document).ready(function(){

		var page = 1;
		console.log(1111);
        function getPageNewsList (page) {
            $.ajax({
                type: "get",
                url: '/index/index/getPageNewsList?limit=2&page='+page,
				
                success: function(result, textStatus){
                    var ulBody = $('#article');
                    chtml = '';
                    var newsList = result.newsList;
                    if(newsList.length == 0){
                        chtml = '没有文章';
                    }else{
                        for(var i in newsList){
                            chtml += '<article class="newsList post"><header><div class="title"><h2><a href="/index/index/detail?nid='+newsList[i].nid+'">'+newsList[i].title+'</a></h2><p>勇敢的人不是不害怕，而是怕也要向前走。</p></div><div class="meta"><time class="published" datetime="2018-06-01">'+newsList[i].ntime+'</time><a href="#" class="author"><span class="name">'+newsList[i].username+'</span><img src="/static/images/avatar.jpg" alt="" /></a></div></header><a href="/index/index/detail?nid='+newsList[i].nid+'" class="image featured"><img src="/uploads/'+newsList[i].imgurl+'" alt="" /></a><div class="content"><p>'+newsList[i].remark+'</p></div><footer><ul class="actions"><li><a href="/index/index/detail?nid='+newsList[i].nid+'" id="reading" class="button big">继续阅读</a></li></ul></footer></article>'
                        }
                    }
                    ulBody.html(chtml);

                    var pageBody = $('#pagination');
                    var pageCount = Math.ceil(result.count/result.limit);
                    phtml = '';
                    for (var i=1;i<=pageCount;i++) {
                        if(i == page){
                            var style = 'class="active"';
                        }else{
                            var style = '';
                        }

                        phtml += "<li "+style+"><a href='javascript:;'  data-page='"+i+"'"+" class='page_btn' >"+i+"</a></li>"

                    }
                    pageBody.html(phtml);

                    $('.page_btn').on('click',function(){
                        var page = $(this).data('page');
                        getPageNewsList(page);
                    });
                }
            });
        }
        getPageNewsList(page);


	})
	
	</script>

</body>

</html>